import {fetchPost} from "../../common/fetch";
import { $ } from "../../common/utils";
export default (conf) => {

    const $form = $("register-payment-form");
    $form.onsubmit = async (e) =>{
        //e.preventDefault();
        let formValue = {};
        Array.from($form.elements).forEach((item) => {
           if (item.name) {
               formValue[item.name] = item.value;
           }
        });
        let data = await fetchPost("/register/payment", formValue);
        console.log(data);
        if (data.code === 200){
            conf.success && conf.success();
        } else {
            conf.error && conf.error();
        }

    }

}